#include <unistd.h>
#include <stdio.h>
#include <sys/types.h>
#include <stdlib.h>
int main(){
  int g_val=100;
  printf("father is running,pid = %d,ppid = %d\n",getpid(),getppid());
  pid_t id=fork();
    if(id==0){
      int cnt=0;
      while(1){
      printf("This is a child fork,pid = %d,ppid = %d,g_val = %d,&g_val = %p\n",getpid(),getppid(),g_val,&g_val);
      sleep(1);
      cnt++;
      if(cnt==5)
      {
        g_val=300;
        printf("This is child, change 100->300\n");
      }
      }
  }
    else{
      while(1){
      printf("This is a father fork,pid = %d,ppid = %d,g_val = %d,&g_val = %p\n",getpid(),getppid(),g_val,&g_val);
      sleep(1);
    }
}
}
